<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/1
 * Time: 14:44
 */

namespace App;


use Illuminate\Database\Eloquent\Model;
use App\Lib\FileService\FastDFS;
class NewsCategory extends Model
{
    protected $table = 'news_categories';
    public $timestamps = false;

    protected $fillable = [
        'name', 'sort_order', 'news_cate_picture','display_flag'
    ];

    public static $BANNER_ID = 1;
    public static $DEFAULT_CATE_CXHD = 2;
    public static $DEFAULT_CATE_JSWZ = 3;



    public static $DISPLAY_FLAG_ON = 1;
    public static $DISPLAY_FLAG_OFF = 2;

    public static $DISPLAY_FLAG_MAP = [
        ['key' => 1, 'text' => '显示'],
        ['key' => 2, 'text' => '不显示']
    ];

    public function getFullPicturePath()
    {
        if (!empty($this->news_cate_picture)) {
            return FastDFS::getFullUrl($this->news_cate_picture);
        }
        return '/images/no-pic-back.png';
    }


}